package com.mail.dubbo.api;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mail.dubbo.mapper.UmsAdminLoginLogMapper;
import com.mail.model.db.UmsAdminLoginLog;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.time.LocalDateTime;

/**
 * @author 吕永乐
 * @date 2022/06/21 13:23
 **/
@DubboService
public class UmsAdminLoginLogApiImpl implements UmsAdminLoginLogApi{

	@Autowired
	private UmsAdminLoginLogMapper umsAdminLoginLogMapper;

	/**
	 * 保存用户登录日志
	 *
	 * @param adminLog
	 */
	@Override
	public void saveLog(UmsAdminLoginLog adminLog) {
		umsAdminLoginLogMapper.insert(adminLog);
	}

	/**
	 * 根据 id 查询登录日志, 获取最后登录时间
	 *
	 * @param id
	 * @return
	 */
	@Override
	public LocalDateTime getLastLoginTime(Long id) {
		return umsAdminLoginLogMapper.getLastLoginTime(id);
	}
}
